package learn.emp01.ex02;

import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNextLine()){
            String input = scanner.nextLine();
            try {
                int num = Integer.parseInt(input);
                if (num >=10000 && num<=20000){
                    System.out.println(Integer.toBinaryString(num) + "," +
                            Integer.toOctalString(num) + "," +
                            Integer.toHexString(num));
                }else {
                    int sum = 0;
                    for (char c : input.toCharArray()){
                        if (Character.isDigit(c)){
                            sum += Character.getNumericValue(c);
                            System.out.print(c + " ");
                        }
                    }
                    System.out.println(sum);
                }
            }
            catch (NumberFormatException e){
                continue;
            }
        }
        scanner.close();
    }
}
